<%-- 
    Document   : userDetails
    Created on : Oct 25, 2012, 1:58:15 PM
    Author     : berto
--%>


<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Register on BCCAStore</title>
  </head>
  <body>
         <div class="content">
            <h2>Register on BCCAStore</h2>
                
            <div id="utilities">
                <p>Insert your personal information to register yourself.</p>
            </div>
                <!-- 
                A questa pagina passo l'oggetto utente con metodo post in modo che sono 
                piu' comodo a caricarlo, oppure come variabile di sessione.
                L'utente lo seleziono dal filter che sara attivato alla richiesta di
                questa pagina.
                -->
            <% 
            String mess=(String)request.getAttribute("om");
            if(mess!=null){
               String errorOn=(String)request.getAttribute("f");
               if(errorOn!=null){
                   mess=mess+"<br/>You have an error on field: \""+errorOn+"\" check it.";
               }
             }else{
                mess="";
             }
            %>
            <br/>
            <p id="register_error_log"><%=mess%></p>
            <form name="form_register" method="post" action="<%=request.getContextPath()%>/contents/public/registerUser">
            <table>
                <tr>
                    <td>Username:</td>
                    <td><input type="text" name="username" 
                         value="<%=(request.getParameter("username")!=null)? request.getParameter("username"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Email:</td>
                    <td><input type="text" name="email" 
                         value="<%=(request.getParameter("email")!=null)? request.getParameter("email"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Confirm Email:</td>
                    <td><input type="text" name="email_confirm" 
                         value="<%=(request.getParameter("email_confirm")!=null)? request.getParameter("email_confirm"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type="password" name="password" 
                         value=""/>
                    </td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type="password" name="password" 
                         value=""/>
                    </td>
                </tr>
                <tr>
                    <td>First name:</td>
                    <td><input type="text" name="first_name" 
                         value="<%=(request.getParameter("first_name")!=null)? request.getParameter("first_name"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Last name:</td>
                    <td><input type="text" name="last_name" 
                         value="<%=(request.getParameter("last_name")!=null)? request.getParameter("last_name"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Birth of date:</td>
                    <td><input type="text" name="birthdate" 
                         value="<%=(request.getParameter("birthdate")!=null)? request.getParameter("birthdate"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Address:</td>
                    <td><input type="text" name="address" 
                         value="<%=(request.getParameter("address")!=null)? request.getParameter("address"):""%>"/>
                    </td>
                </tr>
                <tr>
                    <td>Captcha:</td>
                    <td>
                        <img id="captcha" src="<c:url value="/images/simpleCaptcha.jpg" />" width="150">
                        <br/>
                        <input type="text" name="answer" />
                    </td>
                </tr>
                <tr>
                    <td><input type="reset" name="reset" value="Reset"/></td>
                    <td><input type="button" name="register" value="Register" onClick="ValidateRegistration()"/></td>
                </tr>
            </table>
        </form>
                        <script type="text/javascript" src="<%=request.getContextPath()%>/javascript/register.js"></script>
            </div>
</body>
</html>
